<?php


class VodPackage extends CActiveRecord
{
        public $Vvamjdmvic5i;
        public $Vc44oi54jwev;
        public $Vnrn3hfqbicv;
        public $Vgsvxqaopj3m;
        public $Vx4kp2t5hjlw;
        public $Vj0eaj4zrsmi;
        public $V01xyoijuk2s;
	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}

	
	public function tableName()
	{
		return 'vod_package';
	}

	
	public function rules()
	{
		
		
		return array(
			array('code_name, display_name, status', 'required'),
			array('is_free, create_user_id, modify_user_id, status', 'numerical', 'integerOnly'=>true),
			array('price', 'numerical'),
			array('code_name, display_name, display_name_ascii', 'length', 'max'=>200),
			array('description, description_ascii, tags, tags_ascii', 'length', 'max'=>1000),
			array('create_date, modify_date', 'safe'),
			
			
			array('id, code_name, display_name, display_name_ascii, status, description, description_ascii, tags, tags_ascii, price, is_free, create_user_id, modify_user_id, create_date, modify_date', 'safe', 'on'=>'search'),
                        array('code_name','unique','message'=>'{attribute}:{value} already exists!')
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'createUser' => array(self::BELONGS_TO, 'BackendUser', 'create_user_id'),
			'modifyUser' => array(self::BELONGS_TO, 'BackendUser', 'modify_user_id'),
			'vodPackageDetails' => array(self::HAS_MANY, 'VodPackageDetail', 'vod_package_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'code_name' => 'Code Name',
			'display_name' => 'Display Name',
			'display_name_ascii' => 'Display Name Ascii',
			'description' => 'Description',
			'description_ascii' => 'Description Ascii',
			'tags' => 'Tags',
			'tags_ascii' => 'Tags Ascii',
			'price' => 'Price',
			'is_free' => 'Is Free',
			'create_user_id' => 'Create User',
			'modify_user_id' => 'Modify User',
			'create_date' => 'Create Date',
			'modify_date' => 'Modify Date',
			'status' => 'Status'
		);
	}

	
	public function search()
	{
		
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id);
		$V0v5vsnfxezw->compare('code_name',$this->code_name,true);
		$V0v5vsnfxezw->compare('display_name',$this->display_name,true);
		$V0v5vsnfxezw->compare('display_name_ascii',$this->display_name_ascii,true);
		$V0v5vsnfxezw->compare('description',$this->description,true);
		$V0v5vsnfxezw->compare('description_ascii',$this->description_ascii,true);
		$V0v5vsnfxezw->compare('tags',$this->tags,true);
		$V0v5vsnfxezw->compare('tags_ascii',$this->tags_ascii,true);
		$V0v5vsnfxezw->compare('price',$this->price);
		$V0v5vsnfxezw->compare('is_free',$this->is_free);
		$V0v5vsnfxezw->compare('create_user_id',$this->create_user_id);
		$V0v5vsnfxezw->compare('modify_user_id',$this->modify_user_id);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('modify_date',$this->modify_date,true);
                $V0v5vsnfxezw->compare('status',$this->status,true);
		

		return new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
	}
        
        
        public function getListedForJUI() {
            
                $Vbzpaejiy0xf = VodPackage::model()->findAll(array("order"=>"display_name ASC"));
                $V0o2xhmgxaar = array();
                foreach ($Vbzpaejiy0xf as $Vlqihxrrpwig) {
                    $Vviwclq50lhl = array('0'.$Vlqihxrrpwig->id=>$Vlqihxrrpwig->display_name);
                    $V0o2xhmgxaar = array_merge($V0o2xhmgxaar, $Vviwclq50lhl);
                }
                
                return $V0o2xhmgxaar;
        }
}